using System.Collections.Generic;

namespace 文件上传助手
{
    /// <summary>
    /// 全局上传管理器 - 管理自动上传文件列表
    /// </summary>
    public static class GlobalUploadManager
    {
        private static string _autoUploadFilePath = null;
        private static bool _autoUploadEnabled = false;
        private static readonly object _lock = new object();

        /// <summary>
        /// 设置自动上传文件
        /// </summary>
        public static void SetAutoUploadFile(string filePath)
        {
            lock (_lock)
            {
                _autoUploadFilePath = filePath;
                _autoUploadEnabled = true;
            }
        }

        /// <summary>
        /// 获取待上传的文件列表
        /// </summary>
        public static List<string> GetFilesToUpload()
        {
            lock (_lock)
            {
                if (_autoUploadEnabled && !string.IsNullOrEmpty(_autoUploadFilePath))
                {
                    return new List<string> { _autoUploadFilePath };
                }
                return null;
            }
        }

        /// <summary>
        /// 清除自动上传标志
        /// </summary>
        public static void ClearAutoUpload()
        {
            lock (_lock)
            {
                _autoUploadFilePath = null;
                _autoUploadEnabled = false;
            }
        }

        /// <summary>
        /// 检查是否处于自动上传模式
        /// </summary>
        public static bool IsAutoUploadEnabled()
        {
            lock (_lock)
            {
                return _autoUploadEnabled;
            }
        }
    }
}

